Within the field of computing, many scenarios involve a device storing a set of objects, which typically comprise a set of object resources, such as functions, primitive data types, references to other objects, and data containers such as arrays, hashtables, and trees. Various threads executing within one or more execution environments (e.g., utilizing different programming languages, execution domains, and/or platforms) may create and access the objects, including storing references (e.g., memory addresses or handles) to the objects that are currently in use by the respective threads. An object may be concurrently and/or consecutively accessed by several threads and/or objects, and a reference counter may be used to track the number of references to each object that are held by the threads and stored in other objects. In some instances, concurrent access over a particular shared resource may be achieved through a synchronization mechanism that ensures exclusive access to the object resource by one thread at any one time. The synchronization mechanism, such as a mutex, a semaphore, or a critical section, may triage pending requests; may grant exclusive access over the object resource to a selected thread, while denying other requesting threads access to the object; and may await a completion of the access by the selected thread before transferring exclusive access to a second thread with a pending access request.
When a thread completes its use of an object, it releases its reference (implicitly or explicitly), and the reference count is decremented by one. When the reference count for an object is reduced to zero, the object is deemed to be no longer in use and ready for destruction. The device may finalize the object resources of the object, and may reclaim the memory and computing resources that were reserved and/or consumed by the object. Alternatively, a thread may explicitly request a disposal of an object, and the device may initiate the finalization process, which may include altering any existing references to the object that are held by other threads and/or other objects.